package cn.gjculture.shopping.api.service.impl;

import cn.gjculture.shopping.api.dao.ArtTypeDao;
import cn.gjculture.shopping.api.dao.CommonDeleteMapper;
import cn.gjculture.shopping.api.dao.CommonUpdateMapper;
import cn.gjculture.shopping.api.entity.ArtType;
import cn.gjculture.shopping.api.service.ArtTypeService;
import cn.gjculture.shopping.api.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArtTypeServiceImpl implements ArtTypeService {

    @Autowired
    ArtTypeDao artTypeDao;

    @Autowired
    CommonDeleteMapper commonDeleteMapper;

    @Autowired
    CommonUpdateMapper commonUpdateMapper;

    @Override
    public Integer insert(ArtType artType) {
        artType.setArtTypeId(UUIDUtil.getUUID());
        return artTypeDao.insert(artType);
    }

    @Override
    public Integer update(ArtType artType) {
        return commonUpdateMapper.updateArtType(artType);
    }

    @Override
    public List<ArtType> query() {
        return artTypeDao.query();
    }

    @Override
    public ArtType queryById(String artTypeId) {
        return artTypeDao.queryById(artTypeId);
    }

    @Override
    public Integer deleteMore(List<String> artTypeIds) {
        return commonDeleteMapper.deleteArtType(artTypeIds);
    }
}
